package pe.gob.sedapal.scmultimedia.rcp.listener;
import org.apache.log4j.Logger;
import org.eclipse.core.runtime.ILogListener;
import org.eclipse.core.runtime.IStatus;

public class LogListener implements ILogListener {  
   private static final Logger LOGGER = Logger.getLogger(LogListener.class.getName());  
  
   @Override  
   public void logging(final IStatus status, final String plugin) {  
       if (status.getSeverity() == IStatus.WARNING) {  
           if (status.getException() == null) {  
               LOGGER.warn(status.getMessage());  
           } else {  
               LOGGER.warn(status.getMessage() + status.getException());  
           }  
       } else if (status.getSeverity() == IStatus.ERROR) {  
           if (status.getException() == null) {  
               LOGGER.error(status.getMessage());              
           } else {  
               LOGGER.error(status.getMessage()+status.getException());  
           }  
       }  
   } 
}